// ItemListDlg.cpp : implementation file
//

#include "stdafx.h"
#include "dq9.h"
#include "ItemListDlg.h"

#include "ItemListPanelFactory.h"

#ifdef WIN32
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif //_DEBUG
#endif //WIND32

namespace serika
{
	namespace dq
	{
		// ItemListDlg dialog

		IMPLEMENT_DYNAMIC(ItemListDlg, CDialog)

		ItemListDlg::ItemListDlg(CWnd* pParent /*=NULL*/)
			: CDialog(ItemListDlg::IDD, pParent)
			, mActiveWnd(0)
			, mTabCtrl(true)
		{
		}

		ItemListDlg::~ItemListDlg()
		{
			for (std::vector<CWnd*>::iterator iter = mWnds.begin();
				iter != mWnds.end(); ++iter)
			{
				CWnd* wnd = *iter;
				wnd->DestroyWindow();
				delete wnd;
			}
		}

		void ItemListDlg::DoDataExchange(CDataExchange* pDX)
		{
			CDialog::DoDataExchange(pDX);
		}

		BOOL ItemListDlg::OnInitDialog()
		{
			this->MoveWindow(0, 0, 800, 600);
			this->CenterWindow();

			mTabCtrl.SubclassDlgItem(IDC_ITEM_TAB, this);
			mTabCtrl.Initialize(new ItemListPanelFactory);

			return TRUE;
		}

		BEGIN_MESSAGE_MAP(ItemListDlg, CDialog)
			ON_WM_DESTROY()
		END_MESSAGE_MAP()

		// ItemListDlg message handlers
		void ItemListDlg::OnDestroy()
		{
			mTabCtrl.Finalize();
		}
	}
}

